<template>
  <div class="el-mr-mathouseTable">
    <div class="el-mr-mh-firstbg">
      <el-table
        ref="receiveTable"
        size="mini"
        :data="resData"
        style="width: 100%"
        @selection-change="handleSelectionChange"
        highlight-current-row
        height="350"
      >
        <el-table-column type="selection" width="40"> </el-table-column>
        <el-table-column type="index" label="序号" width="50" :show-overflow-tooltip="true" > </el-table-column>
        <el-table-column prop="carCode" label="小车编号"  :show-overflow-tooltip="true"  > </el-table-column>
        <el-table-column prop="carUser" label="小车使用人" :show-overflow-tooltip="true"  > </el-table-column>
        <el-table-column prop="carStatus" label="小车状态" :show-overflow-tooltip="true" > </el-table-column>
        <!-- <el-table-column prop="carName" label="小车名称" width="100" :show-overflow-tooltip="true"  > </el-table-column> -->
        <el-table-column  prop="carSeat" label="所属站位" width="120"  :show-overflow-tooltip="true"  > </el-table-column>
        <el-table-column prop="createdBy" label="操作人"  :show-overflow-tooltip="true"  > </el-table-column>
        <el-table-column prop="creationDate" label="操作时间" :show-overflow-tooltip="true" width="150" > </el-table-column>
        <el-table-column prop="lastUpdateDate" label="最后修改时间" :show-overflow-tooltip="true" width="150" > </el-table-column>
        <el-table-column prop="remark" label="备注" :show-overflow-tooltip="true" > </el-table-column>
      </el-table>
      <!-- 分页 -->
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="pageNumber"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="totalCount"
      >
      </el-pagination>
    </div>
  </div>
</template>
<script>
import { sysDeliveryTaskData } from "@/utils/api.js";

export default {
  name: "MathouseTable",
  data() {
    return {
      // 当前页数
      pageNumber: 1,
      // 数据总个数
      totalCount: 0,
      // 返回的数据数组
      resData: [],
      // 每页数据个数  row'，'col'，'tmpRow'
      pageSize: 100,
    };
  },
  methods: {
    // 勾选函数
    handleSelectionChange(val) {
      // 将勾选的数据信息给 TopBtn-修改按钮
      this.$bus.$emit('sysDtChange',val)
    },
    // 选择每页条数后请求接口更新表格
    handleSizeChange(val) {
      this.pageSize = val;
      // 传给首页
      this.$bus.$emit('sysDtPageSize',val)
    },
    // 分页函数
    handleCurrentChange(val) {
      this.pageNumber = val;
      // 传给首页
      this.$bus.$emit('sysDtPageNumber',val)
    },
  },
  mounted() {
    // 查询成功将数据给Table
    this.$bus.$on('sysDtSxTable',(e)=>{
      this.resData = e.data.responseBody.result
      this.totalCount = e.data.responseBody.pageParameter.totalCount
    })
    sysDeliveryTaskData({
      searchParams: {
        msWpToolId: '',
        toolCode: '',
        toolName:'' ,
        length:'' ,
        width:'' ,
        height: '',
        bearWeight: '',
        partCnt: '',
      },
      pageParameter: {
        rows: this.pageSize,
        page: this.pageNumber,
      },
    }).then((res) => {
      console.log("配送小车", res);
      this.resData = res.data.responseBody.result;
      this.totalCount = res.data.responseBody.pageParameter.totalCount;
    });
  },
};
</script>
<style scoped>
.el-mr-mh-firstbg {
  width: 100%;
  height: 100%;
  text-align: center;
}
.el-pagination {
  text-align: center;
}
.el-mr-mathouseTable {
  height: 350px;
  /* background-color: red; */
}
</style>